//
//  DnColorPickerViewController.m
//  DnColorPicker
//
//  Created by Ngoc on 24/11/2011.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "DnColorPickerViewController.h"
#import "SwitchViewController.h"

@implementation DnColorPickerViewController

-(IBAction) chooseBackgroundColor:(id)sender
{
    ColorPickerViewController *colorPickerView = [[ColorPickerViewController alloc] init];
    colorPickerView.delegate = self;
    colorPickerView.defaultsColor = self.view.backgroundColor;
   // [self presentModalViewController:colorPickerView animated:YES];
    [[SwitchViewController sharedInstance] switchView:self toView:colorPickerView];
    [colorPickerView release];
    
}
-(void) colorPickerViewController:(ColorPickerViewController *)colorPicker didSelectColor:(UIColor *)color
{
    self.view.backgroundColor = color;
    [[SwitchViewController sharedInstance] goToPreviousView];
  //  [colorPicker dismissModalViewControllerAnimated:YES];
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
